package org.ilc.push;

public class Message {

	/**
	 * 消息状态-等待发送
	 */
	public final static String STATUS_WAIT="0";
	/**
	 * 消息状态-发送成功
	 */
	public final static String STATUS_SEND_SUCESSFUL="1";
	/**
	 *消息状态-发送失败
	 */
	public final static String STATUS_SEND_FAILUER="2";
	/**
	 * 消息状态-发送中
	 */
	public final static String STATUS_SENDING="3";
	/**
	 * 消息状态-过期
	 */
	public final static String STATUS_EXPIRED="4";
	/**
	 * 创建时间
	 */
	private long createTime;
	/**
	 * 过期时间
	 */
	private long expiredTime=0;
	/**
	 * 状态
	 */
	private String status=null;
	/**
	 * 该条消息的接收者
	 */
	private String account;
	/**
	 * 发送时间
	 */
	private long sendTime;
	/**
	 * 发送消息实体
	 */
	private String content;
	public long getCreateTime() {
		return createTime;
	}
	public void setCreateTime(long createTime) {
		this.createTime = createTime;
	}
	public long getExpiredTime() {
		return expiredTime;
	}
	public void setExpiredTime(long expiredTime) {
		this.expiredTime = expiredTime;
	}
	public String getStatus() {
		return status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public String getAccount() {
		return account;
	}
	/**
	 * 消息是否过期
	 * -1表示永不过期
	 *  0表示为临时消息
	 *  
	 * @return
	 */
	public boolean isExpired(){
		if(this.expiredTime==-1){
			return false;
		}
		if(this.expiredTime==0){
			return true;
		}
		return (this.expiredTime+this.createTime)<System.currentTimeMillis();
	}
	public void setAccount(String account) {
		this.account = account;
	}
	public long getSendTime() {
		return sendTime;
	}
	public void setSendTime(long sendTime) {
		this.sendTime = sendTime;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
}
